🎖️GitЯра🎖️
Node / meshtastic / Meshtastic-Android / files / core / repository / src / commonMain / kotlin / org / meshtastic / core / repository / MqttManager.kt
Displaying Raw • Download
core/repository/src/commonMain/kotlin/org/meshtastic/core/repository/MqttManager.kt bf929c20f274232e0eb8ddc19b2dc82403e99e5b (bf929c20) Text, 2.52 KB
T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.core.repository
Tff7b72import T7ee787kotlinx.coroutines.flow.StateFlow
Tff7b72import T7ee787org.meshtastic.core.model.MqttConnectionState
Tff7b72import T7ee787org.meshtastic.core.model.MqttProbeStatus
Tff7b72import T7ee787org.meshtastic.proto.MqttClientProxyMessage
T8b949e/** Interface for managing MQTT proxy communication. */
Tff7b72interface T56d364MqttManager Tb4b4b4{
T8b949e/** Observable MQTT proxy connection state for UI consumption. */
Tff7b72val Te6edf3mqttConnectionStateTb4b4b4: Te6edf3StateFlowTff7b72<Te6edf3MqttConnectionStateTff7b72>
T8b949e/**
* Observable phone-local proxy state: `true` while this phone is actively running the MQTT proxy (relaying broker
* traffic to the connected device). This reflects only the phone-side proxy lifecycle and is independent of the
* device's persisted MQTT config — [stop] and [startProxy] flip it without any device read/write round-trip.
*/
Tff7b72val Te6edf3proxyActiveTb4b4b4: Te6edf3StateFlowTff7b72<Tffa657BooleanTff7b72>
T8b949e/** Starts the MQTT proxy with the given settings. */
Tff7b72fun Td2a8ffstartProxyTb4b4b4(Te6edf3enabledTb4b4b4: Tffa657BooleanTb4b4b4, Te6edf3proxyToClientEnabledTb4b4b4: Tffa657BooleanTb4b4b4)
T8b949e/** Stops the MQTT manager. */
Tff7b72fun Td2a8ffstopTb4b4b4(Tb4b4b4)
T8b949e/** Handles an MQTT proxy message from the radio. */
Tff7b72fun Td2a8ffhandleMqttProxyMessageTb4b4b4(Te6edf3messageTb4b4b4: Te6edf3MqttClientProxyMessageTb4b4b4)
T8b949e/**
* Probe an MQTT broker to verify connectivity and credentials without joining the proxy lifecycle. Intended for UI
* "Test Connection" affordances.
*
* @param address Raw broker address as the user would type it (host, host:port, or full URL).
* @param tlsEnabled `true` upgrades bare addresses to `ssl://` (TLS, port 8883) instead of `tcp://` (plaintext,
* port 1883); ignored when [address] already has a scheme.
* @param username Optional MQTT username.
* @param password Optional MQTT password.
*/
Tff7b72suspend Tff7b72fun Td2a8ffprobeTb4b4b4(Te6edf3addressTb4b4b4: Tffa657StringTb4b4b4, Te6edf3tlsEnabledTb4b4b4: Tffa657BooleanTb4b4b4, Te6edf3usernameTb4b4b4: Tffa657String?Tb4b4b4, Te6edf3passwordTb4b4b4: Tffa657String?Tb4b4b4)Tb4b4b4: Te6edf3MqttProbeStatus
Tb4b4b4}
Served by rngit 1.5.0 - Generated in 0.04s